package memleak.test.com.testlist;

import com.google.gson.Gson;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

/**
 * Created by kelly on 2017/6/15.
 */

public class ChannelCategoryBean {


    /**
     * type : asset
     * id : nn_live
     * name : 直播
     * arg_list : {"category_list":[{"id":"1000001","name":"全部直播","type":"0"},{"id":"1000002","name":"央视频道","type":"0"},{"id":"1000006","name":"卫视频道","type":"0"},{"id":"1000004","name":"广播电台","type":"0"}]}
     * result : {"state":"200","reason":"ok"}
     */

    private String type;
    private String id;
    private String name;
    private ArgListBean arg_list;
    /**
     * state : 200
     * reason : ok
     */

    private ResultBean result;

    public static ChannelCategoryBean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), ChannelCategoryBean.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ArgListBean getArg_list() {
        return arg_list;
    }

    public void setArg_list(ArgListBean arg_list) {
        this.arg_list = arg_list;
    }

    public ResultBean getResult() {
        return result;
    }

    public void setResult(ResultBean result) {
        this.result = result;
    }

    public static class ArgListBean {
        /**
         * id : 1000001
         * name : 全部直播
         * type : 0
         */

        private List<CategoryListBean> category_list;

        public static ArgListBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), ArgListBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public List<CategoryListBean> getCategory_list() {
            return category_list;
        }

        public void setCategory_list(List<CategoryListBean> category_list) {
            this.category_list = category_list;
        }

        public static class CategoryListBean {
            private String id;
            private String name;
            private String type;

            public static CategoryListBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str), CategoryListBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public String getType() {
                return type;
            }

            public void setType(String type) {
                this.type = type;
            }
        }
    }

    public static class ResultBean {
        private String state;
        private String reason;

        public static ResultBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), ResultBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public String getReason() {
            return reason;
        }

        public void setReason(String reason) {
            this.reason = reason;
        }
    }
}
